package com.google.android.gcm.demo.app.model;
import java.io.Serializable;
import java.util.HashMap;

public class Phone implements Serializable {


	/**
	 * 
	 */
	private static final long serialVersionUID = -8792439738172406522L;
	
	private String id;
	private String name;
	private String status;
	private HashMap<String, String> rules;

	public Phone() {
		name = "";
		id = "";
		status = "";
		this.rules = new HashMap<String, String>();
	}

	public Phone(String name, String id, String status) {
		this.name = name;
		this.id = id;
		this.status = status;
		this.rules = new HashMap<String, String>();
	}

	public void addRule(String name, String rule) {
		rules.put(name, rule);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String[] getRules() {
		String[] r = new String[this.rules.size()];
		int i=0;
		for (String s : rules.keySet())
			r[i++] = s + "|" + rules.get(s);
		return r;
	}

	public void setRules(HashMap<String, String> rules) {
		this.rules = rules;
	}

	public void deleteRule(String name) {
		rules.remove(name);
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

}
